﻿using System;
using System.IO;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;

namespace GitNet.WindowsApp.Controls;

public partial class DetailFolderView : UserControl
{
    public DetailFolderView()
    {
        InitializeComponent();
    }

    private void InitializeComponent()
    {
        AvaloniaXamlLoader.Load(this);
    }

    private void ContextInitialized(object? sender, EventArgs e)
    {
        if(sender is not TextBlock block)return;
        if (DataContext is FileInfo file)
            block.Text = File.ReadAllText(file.FullName);
    }
}